package 并发编程13.LockSupport工具类;

import java.util.concurrent.locks.LockSupport;

/**
 * @author idea
 * @data 2019/2/1
 */
public class LockDemo2 implements Runnable {
    public static void main(String[] args) throws InterruptedException {
        System.out.println("start Test");
        Thread thread = new Thread(new LockDemo2());
        thread.start();
        Thread.sleep(100);
        System.out.println("emd");

//        Thread thread2 = new Thread(new LockDemo2());
        //这里面需要指定被堵塞的线程对象，如果对象不同，则无法唤醒
//        LockSupport.unpark(thread2);
    }

    @Override
    public void run() {
        System.out.println("this is demo!");
        LockSupport.parkUntil("PARK",500000000000L);
        System.out.println("ok");
    }
}
